<?php

class View_Helper_BaseUrl extends Zend_View_Helper_Abstract
{
	protected static $_baseurl = null;
	
	public function __construct()
	{
		// Only contruct the baseurl on the first instance
		if (null === self::$_baseurl) {
			
			$url = Zend_Controller_Front::getInstance()->getRequest()->getBaseUrl();
			$root = '/' . trim($url, '/');			
			if ('/' == $root) $root = '';
			
			self::$_baseurl = $root . '/';
		}	
		
	}
	
	
	function baseUrl()
	{
		return self::$_baseurl;
	}
}
